/*
 * @Description: 用与将鼠标移动变大效果的指令
 * @Autor: Bingo
 * @Date: 2024-08-12 11:09:57
 * @LastEditors: Bingo
 * @LastEditTime: 2024-08-14 14:30:08
 */
export default {
  beforeMount(el: any, binding: any, vnode: any) {
    // 定义默认缩放比例
    const scaleSize = binding.value || '1.2'
    el._changeBigMouseoverHandler = async (e: any) => {
      e.stopPropagation();
      el.style.transform = `scale(${scaleSize})`;
    };
    el._changeBigMouseoutHandler = async (e: any) => {
      e.stopPropagation();
      el.style.transform = "scale(1)";
    };

    el.addEventListener("mouseover", el._changeBigMouseoverHandler);
    el.addEventListener("mouseout", el._changeBigMouseoutHandler);
  },

  unmounted(el: any) {
    el.removeEventListener("mouseover", el._changeBigMouseoverHandler);
    el.removeEventListener("mouseout", el._changeBigMouseoutHandler);
  },
};
